package org.codeart.boss.controller;

import org.codeart.boss.service.RelationshipService;
import org.codeart.common.dto.DriverCarBindingRelationship;
import org.codeart.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/driver-car-binding-relationship")
public class RelationshipController {

    @Autowired
    private RelationshipService relationshipService;

    @PostMapping("/bind")
    public R<Void> bind(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship) {
        boolean b = relationshipService.bind(driverCarBindingRelationship);
        if (b) {
            return R.ok();
        }
        return R.fail();
    }

    @PutMapping("/unbind")
    public R<Void> unbind(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship) {
        boolean b = relationshipService.unbind(driverCarBindingRelationship);
        if (b) {
            return R.ok();
        }
        return R.fail();
    }


}
